$(function () {
   $("#login").click(function () {
       var loginName=$("[name='loginname']").val();
       var password=$("[name='password']").val();

       $.ajax({
           url:"easybuy/login",
           data:{
               loginname:loginName,
               password:password
           },
           success:function (data) {
               if (data=="success"){
                   alert("登录成功！");
                   location.href="index.html";
               }else if(data=="failed"){
                   alert("登录失败，密码错误！");
               }else {
                   alert("登录失败，用户名不存在！");
               }
           }
       });
   })
});